import { Column, CreateDateColumn, DeleteDateColumn, Entity, UpdateDateColumn } from 'typeorm'

@Entity('order', { schema: 'itemall' })
export class Order {
  @Column('varchar', { primary: true, name: 'id', length: 255, comment: '订单id' })
  id: string

  @Column('int', {
    name: 'status',
    comment: '订单状态：0代付款 1 已完成 2取消',
    default: () => "'0'",
  })
  status: number

  @Column('double', { name: 'totalPrice', nullable: true, precision: 22 })
  totalPrice: number

  @Column('int', { name: 'uid', comment: '用户id' })
  uid: number

  @Column('varchar', { name: 'address', length: 255, comment: '地址' })
  address: string

  @DeleteDateColumn({ type: 'timestamp', name: 'delDatetime', nullable: true, comment: '删除时间' })
  delDatetime: Date | null

  @CreateDateColumn({ type: 'timestamp', name: 'createDateTime', comment: '创建时间' })
  createDateTime: Date

  @UpdateDateColumn({ type: 'timestamp', name: 'updateDateTime', comment: '修改时间' })
  updateDateTime: Date
}
